package com.community.manage.service.impl;

import com.community.common.entity.GroupGood;
import com.community.common.entity.GroupGoodSku;
import com.community.manage.entity.vo.GroupGoodVo;
import com.community.manage.mapper.ManageMapper;
import com.community.manage.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ManageServiceImpl implements ManageService {

    @Autowired
    ManageMapper manageMapper;

    /**
     * 添加拼团商品
     * @param groupGood
     * @return
     */
    @Override
    public Integer addGroupGood(GroupGoodVo groupGood) {
        return manageMapper.addGroupGood(groupGood);
    }


    /**
     * 添加拼团sku
     * @param goodSkuVoList
     * @param groupId
     */
    @Override
    public void addGroupSku(List<GroupGoodSku> goodSkuVoList, Integer groupId) {
        manageMapper.addGroupSku(goodSkuVoList,groupId);
    }

    /**
     * 删除拼团商品详情
     * @param groupId
     */
    @Override
    public void deleteGroupGoodSku(String groupId) {
        manageMapper.deleteGroupGoodSku(groupId);
    }

    /**
     * 删除拼团商品
     * @param groupId
     */
    @Override
    public void deleteGroupGood(String groupId) {
        manageMapper.deleteGroupGood(groupId);
    }

    /**
     * 修改拼团商品
     * @param groupGoodVo
     */
    @Override
    public void updateGroupGood(GroupGoodVo groupGoodVo) {
        manageMapper.updateGroupGood(groupGoodVo);
    }

    /**
     * 修改拼团商品sku
     * @param goodSkuVoList
     */
    @Override
    public void updateGroupGoodSku(List<GroupGoodSku> goodSkuVoList) {
        manageMapper.updateGroupGoodSku(goodSkuVoList);
    }

    /**
     * 查找此拼团商品是否完成
     * @param id
     * @return
     */
    @Override
    public GroupGood findGroupGood(Integer id) {
        return manageMapper.findGroupGood(id);
    }

    /**
     * 过期 修改状态
     * @param id
     */
    @Override
    public void updateGroupGoodStatus(Integer id) {
        manageMapper.updateGroupGoodStatus(id);
    }
}
